package dome1;

/**
 * Created with IntelliJ IDEA.
 * Description: Comparable接口代码测试
 * User: 王圆豪
 * Date: 2024-06-06
 * Time: 20:12
 */
public class Student implements Comparable<Student>{
    private String name = "xxx";
    private int age;

    public Student(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public Student() {

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }

    @Override
    public int compareTo(Student o) {
        return this.name.compareTo(o.name);
//        return o.age - this.age;
    }
}
